CREATE TABLE [dbo].[TDREND_GAST]
(
[CO_EMPR] [dbo].[TD_VC_002] NOT NULL,
[CO_UNID_CONC] [dbo].[TD_VC_003] NOT NULL,
[NU_REND_GAST] [dbo].[TD_VC_010] NOT NULL,
[FE_REND_GAST] [dbo].[TD_DT_001] NOT NULL,
[NU_CORR_GAST] [dbo].[TD_IN_001] NOT NULL CONSTRAINT [DF__TDREND_GA__NU_CO__4AF81212] DEFAULT ((0)),
[CO_CNTA_EMPR] [dbo].[TD_VC_020] NULL,
[TI_ENTI] [dbo].[TD_VC_001] NULL,
[TI_AUXI_EMPR] [dbo].[TD_VC_001] NULL,
[CO_ENTI] [dbo].[TD_VC_020] NULL,
[DE_ENTI] [dbo].[TD_VC_100] NULL,
[CO_CENT_COST] [dbo].[TD_VC_020] NULL,
[CO_ORDE_SERV] [dbo].[TD_VC_020] NULL,
[FA_CAMB_REND] [dbo].[TD_NU_015_006] NULL,
[IM_CONV] [dbo].[TD_NU_016_004] NOT NULL CONSTRAINT [DF__TDREND_GA__IM_CO__4BEC364B] DEFAULT ((0)),
[CO_TIPO_DOCU] [dbo].[TD_VC_003] NOT NULL,
[NU_DOCU_PROV] [dbo].[TD_VC_020] NOT NULL,
[CO_TIPO_OPER] [dbo].[TD_VC_003] NULL,
[FA_CAMB_DOCU] [dbo].[TD_NU_015_006] NOT NULL CONSTRAINT [DF__TDREND_GA__FA_CA__4CE05A84] DEFAULT ((1.000)),
[DE_OBSE] [dbo].[TD_VC_100] NULL,
[CO_MONE] [dbo].[TD_VC_003] NOT NULL,
[IM_DOCU] [dbo].[TD_NU_016_004] NOT NULL CONSTRAINT [DF__TDREND_GA__IM_DO__4DD47EBD] DEFAULT ((0)),
[FE_DOCU] [dbo].[TD_DT_001] NOT NULL,
[CO_TIOP_PROV] [dbo].[TD_VC_003] NULL,
[IM_BRUT_AFEC] [dbo].[TD_NU_016_004] NULL CONSTRAINT [DF__TDREND_GA__IM_BR__4EC8A2F6] DEFAULT ((0)),
[IM_BRUT_INAF] [dbo].[TD_NU_016_004] NULL CONSTRAINT [DF__TDREND_GA__IM_BR__4FBCC72F] DEFAULT ((0)),
[CO_IMP1] [dbo].[TD_VC_003] NULL,
[PC_IMP1] [dbo].[TD_NU_009_004] NULL CONSTRAINT [DF__TDREND_GA__PC_IM__50B0EB68] DEFAULT ((0)),
[IM_IMP1] [dbo].[TD_NU_015_006] NULL,
[CO_IMP2] [dbo].[TD_VC_003] NULL,
[PC_IMP2] [dbo].[TD_NU_009_004] NULL CONSTRAINT [DF__TDREND_GA__PC_IM__51A50FA1] DEFAULT ((0)),
[IM_IMP2] [dbo].[TD_NU_015_006] NULL,
[CO_IMP3] [dbo].[TD_VC_003] NULL,
[PC_IMP3] [dbo].[TD_NU_009_004] NULL CONSTRAINT [DF__TDREND_GA__PC_IM__529933DA] DEFAULT ((0)),
[IM_IMP3] [dbo].[TD_NU_015_006] NULL,
[NU_IMPO] [dbo].[TD_VC_020] NULL,
[ST_GRAV_NGRA] [dbo].[TD_VC_003] NULL,
[CO_DEPE_ADUA] [dbo].[TD_VC_003] NULL,
[NU_ANNO_ADUA] [dbo].[TD_IN_004_ANOS] NULL,
[FE_REGI_COMP] [dbo].[TD_DT_001] NULL,
[NU_ASTO] [dbo].[TD_VC_020] NULL,
[FE_PAGO] [dbo].[TD_DT_001] NULL,
[CO_USUA_CREA] [dbo].[TD_VC_008_USUA] NOT NULL CONSTRAINT [DF__TDREND_GA__CO_US__54817C4C] DEFAULT (suser_sname()),
[FE_USUA_CREA] [dbo].[TD_DT_001_SIST] NOT NULL CONSTRAINT [DF__TDREND_GA__FE_US__5575A085] DEFAULT (getdate()),
[CO_USUA_MODI] [dbo].[TD_VC_008_USUA] NOT NULL CONSTRAINT [DF__TDREND_GA__CO_US__5669C4BE] DEFAULT (suser_sname()),
[FE_USUA_MODI] [dbo].[TD_DT_001_SIST] NOT NULL CONSTRAINT [DF__TDREND_GA__FE_US__575DE8F7] DEFAULT (getdate())
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[TDREND_GAST] WITH NOCHECK ADD CONSTRAINT [CK__TDREND_GA__NU_AN__538D5813] CHECK NOT FOR REPLICATION (([NU_ANNO_ADUA]>(1980)))
GO
ALTER TABLE [dbo].[TDREND_GAST] ADD CONSTRAINT [PK__TDREND_G__AEE35CC31C330188] PRIMARY KEY CLUSTERED  ([CO_EMPR], [CO_UNID_CONC], [NU_REND_GAST], [FE_REND_GAST], [NU_CORR_GAST]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[TDREND_GAST] ADD CONSTRAINT [FK__TDREND_GAST__69927322] FOREIGN KEY ([CO_EMPR], [CO_TIPO_OPER]) REFERENCES [dbo].[TTTIPO_OPER] ([CO_EMPR], [CO_TIPO_OPER])
GO
ALTER TABLE [dbo].[TDREND_GAST] ADD CONSTRAINT [FK__TDREND_GAST__6A86975B] FOREIGN KEY ([CO_EMPR], [CO_UNID_CONC], [NU_REND_GAST], [FE_REND_GAST]) REFERENCES [dbo].[TCREND_GAST] ([CO_EMPR], [CO_UNID_CONC], [NU_REND_GAST], [FE_REND_GAST])
GO
